pub mod gen;
pub mod arith;
pub mod bool;
pub mod decl;
pub mod scopes;
pub mod sym_type;

use std::error::Error;
use gen::*;
use scopes::*;
use crate::ast::*;
use crate::llvm::*;

pub fn generate_program(my_ast: &mut SysY) -> Result<LLVMProgram, Box<dyn Error>>{
    let mut program = LLVMProgram::new();
    let mut scopes = Scopes::new();
    let mut labels = Labels::new();
    let res = my_ast.generate(&mut program, &mut scopes, &mut labels);
    if let Err(e) = res {
        panic!("Break due to {:?}", e);
    }
    Ok(program)
}

